package com.daoliuhe.scaffold.mapper;

import com.daoliuhe.scaffold.model.Role;
import com.daoliuhe.scaffold.model.User;
import com.daoliuhe.scaffold.model.UserRoleRelation;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.math.BigDecimal;
import java.util.List;

@Mapper
public interface UserRoleRelationMapper {

    int deleteByPrimaryKey(BigDecimal id);

    int deleteRelationForUser(@Param("userId") String userId, @Param("roleIds") List<String> roleIds);

    int deleteRelationForRole(@Param("userIds") List<String> userIds, @Param("roleId") String roleId);

    int insert(UserRoleRelation record);

    int insertSelective(UserRoleRelation record);

    UserRoleRelation selectByPrimaryKey(BigDecimal id);

    List<UserRoleRelation> select(UserRoleRelation record);

    int updateByPrimaryKeySelective(UserRoleRelation record);

    int updateByPrimaryKey(UserRoleRelation record);

    List<Role> getRolePageData(UserRoleRelation record);

    /**
     * 根据工号查询角色
     *
     * @param loginId
     * @return
     */
    List<Role> getRolesByUserLoginId(@Param("loginId") String loginId);

    int getRolePageCount(UserRoleRelation record);

    List<User> getUserPageData(UserRoleRelation record);

    int getUserPageCount(UserRoleRelation record);

    int saveBatchUser(List<UserRoleRelation> list);

}